<?php

$server = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);

socket_bind($server, '127.0.0.1', '8889');
socket_listen($server);

while (true) {
    $client = socket_accept($server);
    if (!$client) {
        continue;
    }
    $request = socket_read($client, 1024);
    var_dump($request);
    socket_close($client);
    echo socket_strerror(socket_last_error($server)) . "\n";
}